#include "Game.h"

Game::Game(void)
{
	graphics = nullptr;
	input = nullptr;

}


Game::~Game(void)
{
	if (graphics)
	{
		delete graphics;
		graphics = nullptr;
	};

	if (input)
	{
		delete input;
		input = nullptr;
	};
}

int Game::start()
{
	graphics = new OgreGraphics();
	input = new Input();

	graphics->init();

	input->init(graphics->getHWnd(), graphics->getWindow(), graphics->getRoot());

	graphics->fillscene();

	while (graphics->isActiveWindow())
	{
//		input->update();

		if (input->isKeyDown(OIS::KC_UP))
			graphics->fuckingCameraUp();
		if (input->isKeyDown(OIS::KC_DOWN))
			graphics->fuckingCameraDown();
		if (input->isKeyDown(OIS::KC_RIGHT))
			graphics->fuckingCameraRight();
		if (input->isKeyDown(OIS::KC_LEFT))
			graphics->fuckingCameraLeft();
		if (input->isKeyDown(OIS::KC_W))
			graphics->fuckingCameraTranslate(0.0f, 0.0f, -0.1f);
		if (input->isKeyDown(OIS::KC_S))
			graphics->fuckingCameraTranslate(0.0f, 0.0f, 0.1f);
		if (input->isKeyDown(OIS::KC_A))
			graphics->fuckingCameraTranslate(-0.1f, 0.0f, 0.0f);
		if (input->isKeyDown(OIS::KC_D))
			graphics->fuckingCameraTranslate(0.1f, 0.0f, 0.0f);

		graphics->draw();
	};

	input->destroy();

	return 0;
}